package demo.method.impl;

import demo.data.Data;
import demo.method.UserMethod;
import demo.model.User;

import java.util.List;

public class UserMethodImpl implements UserMethod {

    @Override
    public String getUserName(long id) {
        List<User> userList = Data.getUserData();
        return userList.stream().filter(user -> user.getId() == id).findAny().orElse(new User()).getName();
    }

    @Override
    public String getUserMobile(long id) {
        List<User> userList = Data.getUserData();
        return userList.stream().filter(user -> user.getId() == id).findAny().orElse(new User()).getMobile();
    }
}
